<template>
  <app-layout viewName="mail_activitycalendarview" viewTitle="活动日历视图" :isShowToolbar="false" :className="{ 'view-container': true, 'default-mode-view': true, 'decalendarview': true, 'mail-activity-calendar-view': true }" layoutMode="VIEW" :isShowUserInfo="isDefaultView()" :openMode="openMode" @close-view="closeView($event)">
    <template slot="headerLeft">
      <div class="view-header-left">

        <div class="view-caption" v-if="isDefaultView()">{{$t(model.srfCaption)}}</div>
        <modal-breadcrumb v-if="isModalView()"/>
      </div>
    </template>
    <template slot="content">
      <div class="view-content-wrapper">
                    <view_calendar 
                :viewState="viewState"  
                :viewparams="viewparams" 
                :context="context" 
                :showBusyIndicator="true"
                name="calendar"  
                ref='calendar' 
                @closeview="closeView($event)">
            </view_calendar>

      </div>
    </template>
  </app-layout>
</template>

<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs';
import { UIActionTool, Util } from '@/utils';
import { VueLifeCycleProcessing, ListView9Base } from '@/crm-core';
import Mail_activityService from '@/service/mail-activity/mail-activity-service';



/**
 * 活动日历视图基类
 *
 * @export
 * @class Mail_activityCalendarViewBase
 * @extends {ListView9Base}
 */
@Component({})
@VueLifeCycleProcessing
export default class Mail_activityCalendarViewBase extends ListView9Base {

    /**
     * 实体服务对象
     *
     * @type {Mail_activityService}
     * @memberof Mail_activityCalendarViewBase
     */
    public appEntityService: Mail_activityService = new Mail_activityService;

    /**
     * 数据变化
     *
     * @param {*} val
     * @returns {*}
     * @memberof Mail_activityCalendarViewBase
     */
    @Emit() 
    public viewDatasChange(val: any):any {
        return val;
    }

	/**
	 * 视图标识
	 *
	 * @type {string}
	 * @memberof Mail_activityCalendarViewBase
	 */
	public viewtag: string = '7f0140604a12474b2e993d9da1b7624d';

    /**
     * 父数据对象
     *
     * @protected
     * @type {*}
     * @memberof Mail_activityCalendarViewBase
     */
    protected srfparentdata: any = {};

	/**
	 * 自定义视图导航上下文集合
	 *
	 * @type {*}
	 * @memberof Mail_activityCalendarViewBase
	 */
    protected customViewNavContexts:any ={
    };

	/**
	 * 自定义视图导航参数集合
	 *
	 * @type {*}
	 * @memberof Mail_activityCalendarViewBase
	 */
    protected customViewParams:any ={
    };

    /**
     * 视图模型数据
     *
     * @type {*}
     * @memberof Mail_activityCalendarViewBase
     */
    public model: any = {
        srfCaption: 'entities.mail_activity.views.calendarview.caption',
        srfTitle: 'entities.mail_activity.views.calendarview.title',
        srfSubTitle: 'entities.mail_activity.views.calendarview.subtitle',
        dataInfo: ''
    }

    /**
     * 容器模型
     *
     * @type {*}
     * @memberof Mail_activityCalendarViewBase
     */
    public containerModel: any = {
        view_calendar: { name: 'calendar', type: 'CALENDAR' },
    };

    /**
     * 视图状态订阅对象
     *
     * @private
     * @type {Subject<{action: string, data: any}>}
     * @memberof Mail_activityCalendarViewBase
     */
    public viewState: Subject<ViewState> = new Subject();


	

    /**
     * 引擎初始化
     *
     * @public
     * @memberof Mail_activityCalendarViewBase
     */
    public engineInit(): void {
    }



    /**
     * 打开新建数据视图
     *
     * @param {any[]} args
     * @param {*} [params]
     * @param {*} [fullargs]
     * @param {*} [$event]
     * @param {*} [xData]
     * @memberof Mail_activityCalendarView
     */
    public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
    this.$Notice.warning({ title: '错误', desc: '未指定关系视图' });
    }


    /**
     * 打开编辑数据视图
     *
     * @param {any[]} args
     * @param {*} [params]
     * @param {*} [fullargs]
     * @param {*} [$event]
     * @param {*} [xData]
     * @memberof Mail_activityCalendarView
     */
    public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
    this.$Notice.warning({ title: '错误', desc: '未指定关系视图' });
    }




    /**
     * 销毁视图回调
     *
     * @memberof Mail_activityCalendarViewBase
     */
    public destroyed(){
        if(this.viewDefaultUsage){
            let localStoreLength = Object.keys(localStorage);
            if(localStoreLength.length > 0){
                localStoreLength.forEach((item:string) =>{
                if(item.startsWith(this.context.srfsessionid)){
                    localStorage.removeItem(item);
                }
                })
            }
        }
    }
    
}
</script>

<style lang='less'>
@import './mail-activity-calendar-view.less';
</style>